﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PurchaseOrder.aspx.cs" Culture="en-GB"
    Inherits="Main_Inventory_PurchaseOrder" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<%--<%@ Register Assembly="CalendarExtenderPlus" Namespace="AjaxControlToolkitPlus" TagPrefix="advancedCalender" %>--%>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Src="~/User Controls/Pager.ascx" TagPrefix="custom" TagName="Pager" %>
<%@ Register Src="~/User Controls/CommonControls.ascx" TagName="CommonControls" TagPrefix="MyControls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Purchase Order</title>
    <link rel="Stylesheet" href="../../Styles/accounts.css" type="text/css" />
    <link href="../../Styles/HorizontalTab.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .AutoExtender
        {
            margin: 0px;
            background-color: White;
            color: windowtext;
            border: 1px solid #006699;
            line-height: 18px;
            padding: 8px;
            border-width: 1px;
            border-style: solid;
            cursor: 'default';
            height: auto;
            min-height: 10px;
            font-family: Verdana, Helvetica, Sans-Serif;
            font-size: .8em;
            font-weight: normal;
            text-align: left;
            list-style-type: none;
        }
        .AutoExtenderList
        {
            border-bottom: solid 1px #006699;
            color: Maroon;
            padding: 1px;
        }
        .AutoExtenderHighlight
        {
            color: White;
            background-color: #006699;
            padding: 1px;
        }
        #Background
        {
            position: fixed;
            top: 0px;
            bottom: 0px;
            left: 0px;
            right: 0px;
            background-color: #E8EAEC;
            opacity: 0.5;
        }
        #Progress
        {
            position: fixed;
            top: 45%;
            margin-left: 350px;
            width: 300px;
            height: 50px;
            text-align: center;
        }
    </style>
    <script type="text/javascript">
        function divExpandCollapse(divname) {
            var div = document.getElementById(divname);
            var img = document.getElementById('img' + divname);
            if (div.style.display == "none") {
                div.style.display = "inline";
                img.src = "../../Menu/images/minus.gif";
            }
            else {
                div.style.display = "none";
                img.src = "../../Menu/images/plus.gif";
            }
        }
        function ItemCheck() {
            alert("Please Select Valid Item Name Or Item Code.");
            return false;
        }
    </script>
</head>
<body oncontextmenu="return false;">
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" EnablePageMethods="true"
        runat="server">
    </asp:ScriptManager>
    <div class="divmain" id="divData" runat="server" visible="false">
        <acc:heading ID="pagehead" runat="server" HeadingText="Purchase Order" />
        <div style="margin-left: 5%; margin-right: 5%; width: 90%" align="center">
            <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label>
        </div>
        <asp:UpdateProgress DynamicLayout="false" AssociatedUpdatePanelID="UpdatePanel4"
            ID="UpdProgress" runat="server">
            <ProgressTemplate>
                <div id="Background" runat="server">
                </div>
                <div align="center" id="Progress">
                    <img src="../../Images/ajax-loader.gif" alt="progessbar" />
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <div style="width: 95%; margin-left: 3%; margin-right: 5%;">
            <center>
                <table class="tablecontent" style="width: 90%">
                    <tr>
                        <td class="headtd" colspan="4" align="left">
                            <asp:Label ID="lbl" runat="server" Text="Purchase Order Details" Width="65%"></asp:Label>
                            Fields marked with <span style="color: Red">*</span> are mandatory
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 15%" align="left">
                            Bill Format<span style="color: Red">*</span>
                        </td>
                        <td style="width: 30%;" align="left">
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                                <ContentTemplate>
                                    <asp:DropDownList ID="ddlFormat" runat="server" AutoPostBack="true" CssClass="input"
                                        Width="175px" OnSelectedIndexChanged="ddlFormat_SelectedIndexChanged" TabIndex="1">
                                    </asp:DropDownList>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </td>
                        <td style="width: 15%" align="left">
                            <%--Date--%>Supplier<span style="color: Red">*</span>
                        </td>
                        <td style="width: 40%" align="left">
                            <asp:UpdatePanel ID="UpdatePanel5" runat="server">
                                <ContentTemplate>
                                    <asp:DropDownList ID="ddlSupplier" runat="server" Width="180px" CssClass="input"
                                        AutoPostBack="true" OnSelectedIndexChanged="ddlSupplier_SelectedIndexChanged"
                                        TabIndex="2">
                                    </asp:DropDownList>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Leased Type<span style="color: Red">*</span>
                        </td>
                        <td align="left">
                            <asp:UpdatePanel ID="UpdatePanel8" runat="server">
                                <ContentTemplate>
                                    <asp:DropDownList ID="ddlleased" onchange="return Change();" CssClass="input" AutoPostBack="true"
                                        runat="server" TabIndex="5" Width="175px" OnSelectedIndexChanged="ddlleased_SelectedIndexChanged">
                                        <asp:ListItem Text="-Select Leased Type-" Value="0"></asp:ListItem>
                                        <asp:ListItem Text="Owned" Value="1"></asp:ListItem>
                                        <asp:ListItem Text="Consigned" Value="2"></asp:ListItem>
                                    </asp:DropDownList>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                            <script type="text/javascript">
                                function Change() {
                                    if (document.getElementById("ddlleased").selectedIndex == 1) {
                                        document.getElementById("tblconsigned").style.display = "none";
                                        document.getElementById("radioCash").checked = true;
                                        document.getElementById("tblowned").style.display = "block";
                                    }
                                    if (document.getElementById("ddlleased").selectedIndex == 2) {
                                        document.getElementById("tblconsigned").style.display = "block";
                                        document.getElementById("radioFOC").checked = true;
                                        document.getElementById("tblowned").style.display = "none";
                                    }
                                    if (document.getElementById("ddlleased").selectedIndex == 0) {
                                        document.getElementById("radioCash").checked = true;
                                        document.getElementById("tblconsigned").style.display = "none";
                                        document.getElementById("tblowned").style.display = "block";
                                    }
                                }
                            </script>
                        </td>
                        <td align="left">
                            Delivery Location<span style="color: Red">*</span>
                        </td>
                        <td align="left">
                            <asp:UpdatePanel ID="UpdatePanel7" runat="server">
                                <ContentTemplate>
                                    <asp:DropDownList ID="DdlLocation" AutoPostBack="true" CssClass="input" runat="server"
                                        Width="180px" TabIndex="4" OnSelectedIndexChanged="DdlLocation_SelectedIndexChanged">
                                    </asp:DropDownList>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                            <asp:HiddenField ID="hidemailId" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Vendor Quote Ref:
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtvendorref" runat="server" CssClass="input" MaxLength="95" TabIndex="7"
                                Width="170px"></asp:TextBox>
                        </td>
                        <td align="left">
                            Priority
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="DdlPriority" CssClass="input" runat="server" Width="180px"
                                TabIndex="6">
                                <asp:ListItem Text="Regular" Value="0"></asp:ListItem>
                                <asp:ListItem Text="Urgent" Value="1"></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td align="left" style="width: 15%">
                            Currency<span style="color: Red">*</span>
                        </td>
                        <td align="left" style="width: 30%">
                            <asp:UpdatePanel ID="UpdatePanel6" runat="server">
                                <ContentTemplate>
                                    <asp:DropDownList ID="ddlcurrency" CssClass="input" runat="server" Width="150px"
                                        TabIndex="8">
                                    </asp:DropDownList>
                                </ContentTemplate>
                            </asp:UpdatePanel>
                        </td>
                        <td align="left" style="width: 15%">
                            Payment Mode<span style="color: Red">*</span>
                        </td>
                        <td align="left" style="width: 40%">
                            <table>
                                <tr>
                                    <td>
                                        <table id="tblowned">
                                            <tr>
                                                <td>
                                                    <asp:RadioButton ID="radioCash" Width="80px" runat="server" Checked="true" GroupName="R"
                                                        onclick="if(this.checked){document.getElementById('txtCreditDay').value='';document.getElementById('txtCreditDay').disabled=true;}"
                                                        TabIndex="9" Text="Advance" ToolTip="Advance " />
                                                </td>
                                                <td>
                                                    <asp:RadioButton ID="radioCOD" Width="50px" runat="server" GroupName="R" onclick="if(this.checked){document.getElementById('txtCreditDay').disabled=true;}"
                                                        TabIndex="10" Text="COD" ToolTip="Cash On Delivery" />
                                                </td>
                                                <td>
                                                    <asp:RadioButton ID="radioCredit" runat="server" Width="60px" GroupName="R" onclick="if(this.checked){document.getElementById('txtCreditDay').value='';document.getElementById('txtCreditDay').disabled=false;}"
                                                        TabIndex="11" Text="Credit" ToolTip="Credit Day" />
                                                    <span id="creditday" style="margin-top: 4px;">&nbsp;<asp:TextBox ID="txtCreditDay"
                                                        runat="server" CssClass="inputnumber" Enabled="false" MaxLength="3" onblur="CreditDays()"
                                                        onKeyPress="return isNumberKey(this.id,event)" TabIndex="12" Width="30px"></asp:TextBox>&nbsp;Days
                                                        &nbsp; </span>
                                                </td>
                                            </tr>
                                        </table>
                                        <table id="tblconsigned" style="display: none;">
                                            <tr>
                                                <td>
                                                    <asp:RadioButton ID="radioFOC" Width="50px" runat="server" Text="FOC" GroupName="R"
                                                        onclick="if(this.checked){document.getElementById('txtCreditDay').disabled=true;}"
                                                        ToolTip="Free Of Cost" />
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                            <%--<asp:RadioButtonList ID="RblPaymentMode" runat="server" RepeatDirection="Horizontal">
                                <asp:ListItem Text="Advance" Value=""></asp:ListItem>
                                <asp:ListItem Text="COD" Value=""></asp:ListItem>
                                <asp:ListItem Text="FOC" Value=""></asp:ListItem>
                                <asp:ListItem Text="Credit" Value=""></asp:ListItem>
                            </asp:RadioButtonList>--%>
                        </td>
                    </tr>
                </table>
            </center>
        </div>
        <div id="wrapper">
            <ul class="tabs">
                <li><a href="javascript:void(0)" class="defaulttab" rel="tabGeneral">General</a></li>
                <li><a href="javascript:void(0)" rel="tabOther">Other</a></li>
            </ul>
            <div class="tab-content" id="tabGeneral" runat="server">
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <div style="width: 100%">
                            <asp:HiddenField ID="hidControl" Value="5" runat="server" />
                            <table id="tblItem" width="100%" runat="server" class="tablecontent" cellpadding="2"
                                cellspacing="0">
                                <tr>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 35%;">
                                        <script type="text/javascript">
                                            function openWindow() {
                                                //window.open('InventoryPrint/PurchaseOrderDisplay.aspx?','','width=800,height=600,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes')"
                                                window.open('Item/Item.aspx?action=addnew&view=458723', '', 'width=1300,height=600,left=20,top=50,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');
                                            }
                                        </script>
                                        <asp:LinkButton ID="lbtnitemname" runat="server" OnClientClick="openWindow();" Text="Item Name">ItemName <span style="color: Red">*</span></asp:LinkButton>
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 15%;">
                                        <asp:Label ID="lblUOM" runat="server" Text="UOM" ToolTip="Unit of Measurement" Width="100px"></asp:Label>
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 10%;">
                                        MPN
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 10%;">
                                        Quantity<span style="color: Red">*</span>
                                    </td>
                                    <td style="border-right: 1px solid #818181; border-bottom: 1px solid #818181; text-align: center;
                                        font-weight: bold; width: 15%;" id="rateexcl" runat="server">
                                        Rate Excl. Tax<span style="color: Red">*</span>
                                    </td>
                                    <td style="border-bottom: 1px solid #818181; text-align: center; font-weight: bold;
                                        width: 15%;">
                                        Amount Payable
                                    </td>
                                </tr>
                                <tr>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtItem1" onPaste="return false;" CssClass="input" runat="server"
                                            TabIndex="13" Width="99%" AutoPostBack="true" OnTextChanged="txtItem_TextChanged"></asp:TextBox>
                                        <AjaxControl:AutoCompleteExtender ID="autoitem1" runat="server" ServiceMethod="GetItemName"
                                            MinimumPrefixLength="1" CompletionInterval="0" EnableCaching="true" FirstRowSelected="false"
                                            TargetControlID="txtItem1" CompletionListCssClass="AutoExtender" CompletionListItemCssClass="AutoExtenderList"
                                            CompletionListHighlightedItemCssClass="AutoExtenderHighlight" OnClientItemSelected="duplicaterow"
                                            ShowOnlyCurrentWordInCompletionListItem="true" DelimiterCharacters=";," CompletionSetCount="20">
                                        </AjaxControl:AutoCompleteExtender>
                                        <script type="text/javascript">
                                            function removetext(id) {
                                                document.getElementById("txtItem" + id).value = "";
                                                alert("Enter the Valid Item Name/Item Code.");
                                                document.getElementById("txtItem" + id).focus();
                                            }
                                            function duplicaterow(source, eventArgs) {
                                                try {
                                                    var count = 1;
                                                    var rowcount = document.getElementById("hidControl").value;
                                                    var valuetocheck = eventArgs.get_text();
                                                    for (var i = 1; i <= rowcount; i++) {
                                                        if (document.getElementById("txtItem" + i).value != '') {
                                                            if (valuetocheck == document.getElementById("txtItem" + i).value) {
                                                                count++;
                                                                if (count > 2) {
                                                                    alert("Duplicate Item Name will not allowed.");
                                                                    document.getElementById("txtItem" + i).value = '';
                                                                    document.getElementById("txtItem" + i).focus();
                                                                    __doPostBack("txtItem" + i, "");
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                catch (error) {

                                                }
                                            }                                            
                                        </script>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtUnit1" runat="server" TabIndex="15" CssClass="input" Width="99%"
                                            Enabled="false" Style="background-color: lightGray; color: Black;"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:DropDownList ID="ddlmpn1" CssClass="input" runat="server" Width="99%">
                                        </asp:DropDownList>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtQty1" runat="server" MaxLength="12" TabIndex="14" CssClass="inputnumber"
                                            Width="99%" onKeyPress="return isNumber(event)" onblur="calcQty(); calcAmt()"
                                            AutoCompleteType="Disabled"></asp:TextBox>
                                        <script type="text/javascript">
                                            function isNumber(evt) {
                                                var charCode = (evt.which)
                                                //alert(charCode); 
                                                if (charCode == 46 || charCode == 47 || charCode == 44 || charCode == 59) {//&& charCode > 31 && (charCode < 48 || charCode > 57)) {
                                                    return false;
                                                }
                                                if (charCode > 65 && charCode < 91) {
                                                    return false;
                                                }
                                                if (charCode > 95 && charCode < 121) {
                                                    return false;
                                                }
                                                return true;
                                            }
                                        </script>
                                    </td>
                                    <td style="vertical-align: top" id="rateexcl1" runat="server">
                                        <asp:TextBox ID="txtRateExcTax1" runat="server" TabIndex="16" CssClass="inputnumber"
                                            Width="99%" onKeyPress="return isNumberKey(this.id,event)" onblur="calcRateExcl(); calcAmt()"
                                            AutoCompleteType="Disabled" MaxLength="10"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtAmountPayable1" runat="server" TabIndex="19" CssClass="inputnumber"
                                            Width="97%" Enabled="false" AutoCompleteType="Disabled" Style="background-color: lightGray;
                                            color: Black;"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtItem2" runat="server" onPaste="return false;" CssClass="input"
                                            Width="99%" AutoPostBack="true" OnTextChanged="txtItem_TextChanged"></asp:TextBox>
                                        <AjaxControl:AutoCompleteExtender ID="AutoItem2" runat="server" ServiceMethod="GetItemName"
                                            MinimumPrefixLength="1" CompletionInterval="0" EnableCaching="false" FirstRowSelected="false"
                                            OnClientItemSelected="duplicaterow" TargetControlID="txtItem2" CompletionListCssClass="AutoExtender"
                                            CompletionListItemCssClass="AutoExtenderList" CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
                                            CompletionListElementID="divwidth1">
                                        </AjaxControl:AutoCompleteExtender>
                                        <script type="text/javascript">
                                            function CheckDuplicateRow() {
                                                var Count = document.getElementById("hidControl").value;
                                                k = false; p = 1;
                                                for (var i = 1; i < Count; i++) {
                                                    if (document.getElementById("txtItem" + i).value != '') {
                                                        GetValue = document.getElementById("txtItem" + i).value;
                                                        for (var j = 1; j < Count; j++) {
                                                            if (document.getElementById("txtItem" + j).value != '') {
                                                                Comparevalue = document.getElementById("txtItem" + j).value;
                                                                if (GetValue == Comparevalue) {
                                                                    k = true;
                                                                    p++;
                                                                }
                                                                if (k && p > 2) {
                                                                    if (GetValue == Comparevalue) {
                                                                        alert('Duplicate Item is Inserted into Row No ' + ' ' + j);
                                                                        document.getElementById("txtItem" + j).value = '';
                                                                        document.getElementById("txtQty" + j).value = '';
                                                                        document.getElementById("txtRateExcTax" + j).value = '';
                                                                        document.getElementById("txtItem" + j).focus();
                                                                        return false;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        </script>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtUnit2" runat="server" Width="99%" CssClass="input" Enabled="false"
                                            AutoCompleteType="Disabled" Style="background-color: lightGray; color: Black;"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:DropDownList ID="ddlmpn2" CssClass="input" runat="server" Width="99%">
                                        </asp:DropDownList>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtQty2" runat="server" MaxLength="12" CssClass="inputnumber" Width="99%"
                                            onKeyPress="return isNumber(event)" AutoCompleteType="Disabled" onblur="calcQty(); calcAmt()"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top" id="rateexcl2" runat="server">
                                        <asp:TextBox ID="txtRateExcTax2" runat="server" MaxLength="10" CssClass="inputnumber"
                                            Width="99%" onKeyPress="return isNumberKey(this.id,event)" onblur="calcRateExcl(); calcAmt()"
                                            AutoCompleteType="Disabled"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtAmountPayable2" runat="server" CssClass="inputnumber" Width="97%"
                                            Enabled="false" AutoCompleteType="Disabled" Style="background-color: lightGray;
                                            color: Black;"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtItem3" runat="server" onPaste="return false;" CssClass="input"
                                            Width="99%" AutoPostBack="true" OnTextChanged="txtItem_TextChanged"></asp:TextBox>
                                        <AjaxControl:AutoCompleteExtender ID="AutoItem3" runat="server" ServiceMethod="GetItemName"
                                            MinimumPrefixLength="1" CompletionInterval="0" EnableCaching="false" FirstRowSelected="false"
                                            OnClientItemSelected="duplicaterow" TargetControlID="txtItem3" CompletionListCssClass="AutoExtender"
                                            CompletionListItemCssClass="AutoExtenderList" CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
                                            CompletionListElementID="divwidth1">
                                        </AjaxControl:AutoCompleteExtender>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtUnit3" runat="server" Width="99%" CssClass="input" Enabled="false"
                                            AutoCompleteType="Disabled" Style="background-color: lightGray; color: Black;"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:DropDownList ID="ddlmpn3" CssClass="input" runat="server" Width="99%">
                                        </asp:DropDownList>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtQty3" runat="server" MaxLength="12" CssClass="inputnumber" onblur="calcQty(); calcAmt()"
                                            Width="99%" onKeyPress="return isNumber(event)" AutoCompleteType="Disabled"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top" id="rateexcl3" runat="server">
                                        <asp:TextBox ID="txtRateExcTax3" runat="server" MaxLength="10" CssClass="inputnumber"
                                            Width="99%" onblur="calcRateExcl(); calcAmt()" onKeyPress="return isNumberKey(this.id,event)"
                                            AutoCompleteType="Disabled"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtAmountPayable3" runat="server" CssClass="inputnumber" Width="97%"
                                            Enabled="false" AutoCompleteType="Disabled" Style="background-color: lightGray;
                                            color: Black;"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtItem4" runat="server" onPaste="return false;" CssClass="input"
                                            Width="99%" AutoPostBack="true" OnTextChanged="txtItem_TextChanged"></asp:TextBox>
                                        <AjaxControl:AutoCompleteExtender ID="AutoItem4" runat="server" ServiceMethod="GetItemName"
                                            MinimumPrefixLength="1" CompletionInterval="0" EnableCaching="false" FirstRowSelected="false"
                                            OnClientItemSelected="duplicaterow" TargetControlID="txtItem4" CompletionListCssClass="AutoExtender"
                                            CompletionListItemCssClass="AutoExtenderList" CompletionListHighlightedItemCssClass="AutoExtenderHighlight"
                                            CompletionListElementID="divwidth1">
                                        </AjaxControl:AutoCompleteExtender>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtUnit4" runat="server" Width="99%" CssClass="input" Enabled="false"
                                            AutoCompleteType="Disabled" Style="background-color: lightGray; color: Black;"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:DropDownList ID="ddlmpn4" CssClass="input" runat="server" Width="99%">
                                        </asp:DropDownList>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtQty4" runat="server" MaxLength="12" onblur="calcQty(); calcAmt()"
                                            CssClass="inputnumber" Width="99%" onKeyPress="return isNumber(event)" AutoCompleteType="Disabled"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top" id="rateexcl4" runat="server">
                                        <asp:TextBox ID="txtRateExcTax4" MaxLength="10" runat="server" CssClass="inputnumber"
                                            Width="99%" onblur="calcRateExcl(); calcAmt()" onKeyPress="return isNumberKey(this.id,event)"
                                            AutoCompleteType="Disabled"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtAmountPayable4" runat="server" CssClass="inputnumber" Width="97%"
                                            Enabled="false" AutoCompleteType="Disabled" Style="background-color: lightGray;
                                            color: Black;"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtItem5" runat="server" onPaste="return false;" Width="99%" CssClass="input"
                                            AutoPostBack="true" OnTextChanged="txtItem_TextChanged"></asp:TextBox>
                                        <AjaxControl:AutoCompleteExtender ID="AutoItem5" runat="server" ServiceMethod="GetItemName"
                                            MinimumPrefixLength="1" CompletionInterval="0" EnableCaching="false" FirstRowSelected="false"
                                            OnClientItemSelected="duplicaterow" TargetControlID="txtItem5" CompletionListCssClass="AutoExtender"
                                            CompletionListItemCssClass="AutoExtenderList" CompletionListHighlightedItemCssClass="AutoExtenderHighlight">
                                        </AjaxControl:AutoCompleteExtender>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtUnit5" runat="server" Width="99%" CssClass="input" Enabled="false"
                                            AutoCompleteType="Disabled" Style="background-color: lightGray; color: Black;"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:DropDownList ID="ddlmpn5" CssClass="input" runat="server" Width="99%">
                                        </asp:DropDownList>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtQty5" runat="server" MaxLength="12" onblur="calcQty(); calcAmt()"
                                            CssClass="inputnumber" Width="99%" onKeyPress="return isNumber(event)" AutoCompleteType="Disabled"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top;" id="rateexcl5" runat="server">
                                        <asp:TextBox ID="txtRateExcTax5" MaxLength="10" runat="server" CssClass="inputnumber"
                                            Width="99%" onblur="calcRateExcl(); calcAmt()" onKeyPress="return isNumberKey(this.id,event)"
                                            AutoCompleteType="Disabled"></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtAmountPayable5" runat="server" CssClass="inputnumber" Width="97%"
                                            Enabled="false" AutoCompleteType="Disabled" Style="background-color: lightGray;
                                            color: Black;"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                            <table style="width: 98%; margin: 5px;" align="right">
                                <tr>
                                    <td>
                                        <asp:LinkButton ID="btnAddMore" runat="server" OnClick="btnAddMore_Click" OnClientClick="return checkformat();"> 
                                        <img src="../../Images/More.jpg" alt="Add New Row" /></asp:LinkButton>
                                        <script type="text/javascript">
                                            function checkformat() {
                                                if (document.getElementById("ddlFormat").selectedIndex == 0) {
                                                    alert("Please check the Format");
                                                    return false;
                                                }
                                            }
                                        </script>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div style="width: 100%">
                            <div style="width: 40%; float: left; margin-right: 8%">
                                <table>
                                    <tr>
                                        <td>
                                            <strong>Vendor Informations</strong>
                                        </td>
                                        <td>
                                            __________
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="margin-left: 8px">
                                            Opening Balance
                                        </td>
                                        <td style="text-align: right">
                                            <asp:Label ID="lblVenderOB" runat="server"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:Label ID="lblVenderDrCr" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="margin-left: 8px">
                                            Debits
                                        </td>
                                        <td style="text-align: right">
                                            <asp:Label ID="lblVendorDebit" runat="server"></asp:Label>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="margin-left: 8px">
                                            Credits
                                        </td>
                                        <td style="text-align: right">
                                            <asp:Label ID="lblVendorCredit" runat="server"></asp:Label>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="margin-left: 8px">
                                            Closing Balance
                                        </td>
                                        <td style="text-align: right">
                                            <asp:Label ID="lblVenderClosing" runat="server"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:Label ID="lblVenderDrCr2" runat="server"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="margin-left: 8px">
                                            Credit Limit
                                        </td>
                                        <td style="text-align: right">
                                            <asp:Label ID="lblVendorCreditLimit" runat="server"></asp:Label>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div style="width: 50%; float: right" align="right">
                                <table style="width: 98%; text-align: right;">
                                    <tr>
                                        <td style="width: 75%">
                                            Item Total
                                        </td>
                                        <td style="width: 25%">
                                            <asp:TextBox ID="txtTotalItem" Width="125px" runat="server" CssClass="inputnumber"
                                                Enabled="false" AutoCompleteType="Disabled" Style="background-color: #D3D3D3;
                                                color: Black;"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <%--<tr>
                                        <td>
                                            Pre Tax Total
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtPreTotalTax" runat="server" CssClass="inputnumber" onKeyPress="return false"
                                                AutoCompleteType="Disabled"></asp:TextBox>
                                        </td>
                                    </tr>--%>
                                    <tr>
                                        <td>
                                            Taxable Amount
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtTaxableAmt" Width="125px" runat="server" CssClass="inputnumber"
                                                Enabled="false" AutoCompleteType="Disabled" Style="background-color: #D3D3D3;
                                                color: Black;"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <%--<tr id="vatcstrow" runat="server">
                                        <td>
                                            VAT/CST &nbsp;
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtVat" runat="server" CssClass="inputnumber" Enabled="false"
                                                AutoCompleteType="Disabled" Style="background-color: lightGray; color:Black;"></asp:TextBox>
                                        </td>
                                    </tr>--%>
                                    <tr>
                                        <td>
                                            Post Tax Total
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtPostTaxTotal" Width="125px" runat="server" CssClass="inputnumber"
                                                Enabled="false" AutoCompleteType="Disabled" Style="background-color: #D3D3D3;
                                                color: Black;"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Round off Amount
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtRoundoff" MaxLength="10" Width="125px" runat="server" CssClass="inputnumber"
                                                onKeyPress="return isNumberKey(this.id,event)" AutoCompleteType="Disabled" Text="0.00"
                                                onblur="RoundOff();"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            Grand Total
                                        </td>
                                        <td>
                                            <asp:TextBox ID="txtGrandTotal" Width="125px" runat="server" CssClass="inputnumber"
                                                Enabled="false" AutoCompleteType="Disabled" Style="background-color: #D3D3D3;
                                                color: Black;"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <div style="clear: both;">
                    &nbsp;</div>
            </div>
            <div class="tab-content" id="tabOther" runat="server">
                <asp:UpdatePanel ID="UpdatePanel3" runat="server">
                    <ContentTemplate>
                        <div style="width: 100%">
                            <div style="width: 45%; float: left;">
                                <table style="width: 100%">
                                    <tr>
                                        <td style="width: 30%">
                                            Billing Address<span class="required">*</span>
                                        </td>
                                        <td style="width: 70%">
                                            <asp:TextBox ID="txtBillAddress" runat="server" ReadOnly="true" TextMode="MultiLine"
                                                CssClass="input" Style="background-color: #808080; color: Black;" Width="97%"
                                                Height="60px"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%">
                                            Delivery Address<span class="required">*</span>
                                        </td>
                                        <td style="width: 70%">
                                            <asp:TextBox ID="txtDeliveryAdd" runat="server" TextMode="MultiLine" CssClass="input"
                                                Width="97%" Height="60px"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%">
                                            Terms of Delivery<span class="required">*</span>
                                        </td>
                                        <td style="width: 70%">
                                            <table width="100%" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td width="100%">
                                                        <asp:DropDownList ID="ddlDeliveryTerms" CssClass="input" runat="server" Width="20%">
                                                            <asp:ListItem></asp:ListItem>
                                                            <asp:ListItem Value="1">EXW</asp:ListItem>
                                                            <asp:ListItem Value="2">FCA</asp:ListItem>
                                                            <asp:ListItem Value="3">CPT</asp:ListItem>
                                                            <asp:ListItem Value="4">CIP</asp:ListItem>
                                                            <asp:ListItem Value="5">DAT</asp:ListItem>
                                                            <asp:ListItem Value="6">DAP</asp:ListItem>
                                                            <asp:ListItem Value="7">FOB</asp:ListItem>
                                                            <asp:ListItem Value="8">CFR</asp:ListItem>
                                                            <asp:ListItem Value="9">CIF</asp:ListItem>
                                                            <asp:ListItem Value="10">DAF</asp:ListItem>
                                                            <asp:ListItem Value="11">DES</asp:ListItem>
                                                            <asp:ListItem Value="12">DEQ</asp:ListItem>
                                                            <asp:ListItem Value="13">DDU</asp:ListItem>
                                                        </asp:DropDownList>
                                                        <asp:TextBox ID="txtDeliveryTerms" MaxLength="340" runat="server" CssClass="input"
                                                            Width="76%"></asp:TextBox>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%">
                                            Any Special Condition<span class="required">*</span>
                                        </td>
                                        <td style="width: 70%">
                                            <%--<asp:TextBox ID="txtNarration" runat="server" Width="97%" CssClass="input"></asp:TextBox>--%>
                                            <asp:TextBox ID="txtanyspecialcondition" runat="server" MaxLength="100" Width="97%"
                                                CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div style="width: 55%;">
                                <table style="width: 100%">
                                    <tr>
                                        <td style="width: 30%">
                                            Handling &amp; Packing<span class="required">*</span>
                                        </td>
                                        <td style="width: 25%">
                                            <asp:DropDownList ID="ddlhandling" runat="server" CssClass="input">
                                                <asp:ListItem>Inclusive</asp:ListItem>
                                                <asp:ListItem>Exclusive</asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                        <td style="width: 25%">
                                            Tax Duties<span class="required">*</span>
                                        </td>
                                        <td style="width: 20%">
                                            <asp:TextBox ID="txttaxDuties" CssClass="input" Style="background-color: #808080;
                                                color: Black;" runat="server" Width="85px" Text="Exclusive" onKeyPress="return false;"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 15%">
                                            Mode Dispatch<span class="required">*</span>
                                        </td>
                                        <td style="width: 65%" colspan="3">
                                            <asp:RadioButtonList ID="RblModeDispatch" runat="server" RepeatDirection="Horizontal"
                                                onClick="return CheckMode();" Width="100%">
                                                <asp:ListItem Text="Air" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="Sea" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="Road" Value="3"></asp:ListItem>
                                                <asp:ListItem Text="Train" Value="4"></asp:ListItem>
                                                <asp:ListItem Text="Courier" Value="5"></asp:ListItem>
                                                <asp:ListItem Text="Others" Value="0"></asp:ListItem>
                                            </asp:RadioButtonList>
                                            <asp:TextBox ID="txtModeDispatch" runat="server" MaxLength="50" CssClass="input"
                                                Width="97%" Style="display: none;"></asp:TextBox>
                                            <script type="text/javascript">
                                                function CheckMode() {
                                                    var RadioValue = document.getElementById("RblModeDispatch");
                                                    var RadioTagName = RadioValue.getElementsByTagName("input");
                                                    for (var j = 0; j < RadioTagName.length; j++) {
                                                        if (RadioTagName[j].checked) {
                                                            if (RadioTagName[j].value == "0") {
                                                                document.getElementById("txtModeDispatch").style["display"] = "block";
                                                            }
                                                            else {
                                                                document.getElementById("txtModeDispatch").style["display"] = "none";
                                                            }
                                                        }
                                                    }
                                                }
                                            </script>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 15%">
                                            Delivery Date<span class="required">*</span>
                                        </td>
                                        <td style="width: 65%" colspan="3">
                                            <asp:TextBox ID="txtDeliveryDate" runat="server" onkeyPress="return false;" Width="97%"
                                                CssClass="input" ValidationGroup="V"></asp:TextBox>
                                            <AjaxControl:CalendarExtender ID="extCal2" runat="server" TargetControlID="txtDeliveryDate"
                                                Format="dd/MM/yyyy">
                                            </AjaxControl:CalendarExtender>
                                            <%--<AjaxControl:MaskedEditExtender ID="maskDeliveryDate" runat="server" TargetControlID="txtDeliveryDate"
                                                MaskType="Date" Mask="99/99/9999" CultureName="en-GB">
                                            </AjaxControl:MaskedEditExtender>
                                            <AjaxControl:MaskedEditValidator ID="maskValidDelivery" InvalidValueMessage="Invalid Date"
                                                runat="server" ControlToValidate="txtDeliveryDate" ControlExtender="maskDeliveryDate"
                                                IsValidEmpty="true" ValidationGroup="V"></AjaxControl:MaskedEditValidator>--%>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 15%">
                                            Acceptance Criteria<span class="required">*</span>
                                        </td>
                                        <td style="width: 65%" colspan="3">
                                            <asp:RadioButtonList ID="RblAcceptanceCriteria" runat="server" RepeatDirection="Horizontal"
                                                onClick="return CheckAcceptMode();">
                                                <asp:ListItem Text="As Per Quality" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="Others" Value="0"></asp:ListItem>
                                            </asp:RadioButtonList>
                                            <asp:TextBox ID="txtAcceptanceCriteria" runat="server" MaxLength="100" Width="97%"
                                                CssClass="input" Style="display: none;"></asp:TextBox>
                                            <script type="text/javascript">
                                                function CheckAcceptMode() {
                                                    var RadioValue = document.getElementById("RblAcceptanceCriteria");
                                                    var RadioTagName = RadioValue.getElementsByTagName("input");
                                                    for (var j = 0; j < RadioTagName.length; j++) {
                                                        if (RadioTagName[j].checked) {
                                                            if (RadioTagName[j].value == "0") {
                                                                document.getElementById("txtAcceptanceCriteria").style["display"] = "block";
                                                            }
                                                            else {
                                                                document.getElementById("txtAcceptanceCriteria").style["display"] = "none";
                                                            }
                                                        }
                                                    }
                                                }
                                            </script>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 15%">
                                            Validity of PO<span class="required">*</span>
                                        </td>
                                        <td style="width: 65%" colspan="3">
                                            <asp:RadioButtonList ID="RblvalidityofPO" runat="server" RepeatDirection="Horizontal"
                                                onClick="return CheckValidityMode();">
                                                <asp:ListItem Text="15 days" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="30 days" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="Others" Value="0"></asp:ListItem>
                                            </asp:RadioButtonList>
                                            <asp:TextBox ID="txtvalidityofPO" MaxLength="100" runat="server" Width="97%" CssClass="input"
                                                Style="display: none;"></asp:TextBox>
                                            <script type="text/javascript">
                                                function CheckValidityMode() {
                                                    var RadioValue = document.getElementById("RblvalidityofPO");
                                                    var RadioTagName = RadioValue.getElementsByTagName("input");
                                                    for (var j = 0; j < RadioTagName.length; j++) {
                                                        if (RadioTagName[j].checked) {
                                                            if (RadioTagName[j].value == "0") {
                                                                document.getElementById("txtvalidityofPO").style["display"] = "block";
                                                            }
                                                            else {
                                                                document.getElementById("txtvalidityofPO").style["display"] = "none";
                                                            }
                                                        }
                                                    }
                                                }
                                            </script>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 15%">
                                            In Transit Insurance<span class="required">*</span>
                                        </td>
                                        <td style="width: 65%" colspan="3">
                                            <asp:RadioButtonList ID="RblInsurance" runat="server" RepeatDirection="Horizontal"
                                                onClick="return CheckInsuranceMode();">
                                                <asp:ListItem Text="By Supplier Account" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="By Buyer Account" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="Others" Value="0"></asp:ListItem>
                                            </asp:RadioButtonList>
                                            <asp:TextBox ID="txtInsurance" runat="server" MaxLength="100" Width="97%" CssClass="input"
                                                Style="display: none;"></asp:TextBox>
                                            <script type="text/javascript">
                                                function CheckInsuranceMode() {
                                                    var RadioValue = document.getElementById("RblInsurance");
                                                    var RadioTagName = RadioValue.getElementsByTagName("input");
                                                    for (var j = 0; j < RadioTagName.length; j++) {
                                                        if (RadioTagName[j].checked) {
                                                            if (RadioTagName[j].value == "0") {
                                                                document.getElementById("txtInsurance").style["display"] = "block";
                                                            }
                                                            else {
                                                                document.getElementById("txtInsurance").style["display"] = "none";
                                                            }
                                                        }
                                                    }
                                                }
                                            </script>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 15%">
                                            Warranty<span class="required">*</span>
                                        </td>
                                        <td style="width: 65%" colspan="3">
                                            <asp:RadioButtonList ID="RblWarranty" runat="server" RepeatDirection="Horizontal"
                                                onClick="return CheckWarrantyMode();">
                                                <asp:ListItem Text="By Supplier Account" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="By Buyer Account " Value="2"></asp:ListItem>
                                                <asp:ListItem Text="Others" Value="0"></asp:ListItem>
                                            </asp:RadioButtonList>
                                            <asp:TextBox ID="txtWarranty" runat="server" MaxLength="100" Width="97%" CssClass="input"
                                                Style="display: none;"></asp:TextBox>
                                            <script type="text/javascript">
                                                function CheckWarrantyMode() {
                                                    var RadioValue = document.getElementById("RblWarranty");
                                                    var RadioTagName = RadioValue.getElementsByTagName("input");
                                                    for (var j = 0; j < RadioTagName.length; j++) {
                                                        if (RadioTagName[j].checked) {
                                                            if (RadioTagName[j].value == "0") {
                                                                document.getElementById("txtWarranty").style["display"] = "block";
                                                            }
                                                            else {
                                                                document.getElementById("txtWarranty").style["display"] = "none";
                                                            }
                                                        }
                                                    }
                                                }
                                            </script>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 30%">
                                            Freight Forwarders<span class="required">*</span>
                                        </td>
                                        <td style="width: 25%">
                                            <asp:TextBox ID="txtfreightfwd" runat="server" MaxLength="150" CssClass="input" Width="91px"></asp:TextBox>
                                        </td>
                                        <td style="width: 25%">
                                            Import Account No<span class="required">*</span>
                                        </td>
                                        <td style="width: 20%">
                                            <asp:TextBox ID="txtimpacno" runat="server" MaxLength="150" CssClass="input" Width="85px"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 15%">
                                            Remarks
                                        </td>
                                        <td style="width: 65%" colspan="3">
                                            <asp:TextBox ID="txtRemark" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 15%">
                                            Freight<span class="required">*</span>
                                        </td>
                                        <td style="width: 65%" colspan="3">
                                            <asp:RadioButtonList ID="RBLFreight" runat="server" RepeatDirection="Horizontal"
                                                onClick="return CheckFreightMode();">
                                                <asp:ListItem Text="Exclusive" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="Inclusive" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="Others" Value="0"></asp:ListItem>
                                            </asp:RadioButtonList>
                                            <asp:TextBox ID="txtfreight" runat="server" MaxLength="200" Width="97%" CssClass="input"
                                                Style="display: none;"></asp:TextBox>
                                            <script type="text/javascript">
                                                function CheckFreightMode() {
                                                    var RadioValue = document.getElementById("RBLFreight");
                                                    var RadioTagName = RadioValue.getElementsByTagName("input");
                                                    for (var j = 0; j < RadioTagName.length; j++) {
                                                        if (RadioTagName[j].checked) {
                                                            if (RadioTagName[j].value == "0") {
                                                                document.getElementById("txtfreight").style["display"] = "block";
                                                            }
                                                            else {
                                                                document.getElementById("txtfreight").style["display"] = "none";
                                                            }
                                                        }
                                                    }
                                                }
                                            </script>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <div style="clear: both">
                    &nbsp;</div>
            </div>
            <div style="width: 98%">
                <asp:UpdatePanel ID="UpdatePanel4" runat="server">
                    <ContentTemplate>
                        <table style="width: 98%; text-align: center">
                            <tr>
                                <td>
                                    <asp:Button ID="btnSubmit" Text="Submit" runat="server" CssClass="button" OnClick="btnSubmit_Click"
                                        OnClientClick="return ValidationInput();" ValidationGroup="V" />
                                    &nbsp;
                                    <asp:Button ID="btnCancel" Text="Cancel" runat="server" CssClass="button" OnClick="btnCancel_Click" />
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
        </div>
    </div>
    <div id="divprint" runat="server" visible="false">
        <acc:heading ID="Heading1" runat="server" HeadingText="Purchase Order View" />
        <div style="margin-left: 30%;">
            <div style="float: left;">
                <%-- <custom:Pager ID="custPager" runat="server" OnPageChanged="custPager_PageChanged" />--%>
            </div>
        </div>
        <center>
            <div id="Viewwrapper">
            <ul class="tabs">
                <li><a href="javascript:void(0)" class="defaulttab" rel="ViewtabGeneral">Domestic PO</a></li>
                <li><a href="javascript:void(0)" rel="ViewtabOther">International PO</a></li>
            </ul>
            <div class="tab-content" id="ViewtabGeneral" runat="server">
            <asp:GridView ID="grdDisplay" Width="99%" runat="server" AutoGenerateColumns="false"
                CssClass="gridview" AllowPaging="false" DataKeyNames="POID" AlternatingRowStyle-CssClass="gridview_alternate"
                PagerStyle-CssClass="pgr" RowStyle-CssClass="gridviewitem" FooterStyle-CssClass="gridviewitem" OnRowCommand="grdDisplay_RowCommand"
                OnRowDataBound="grdDisplay_RowDataBound" OnRowCreated="grdDisplay_RowCreated" PageSize="500">
                <Columns>
                    <asp:TemplateField HeaderText="S.No." ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%# Container.DataItemIndex+1 %>
                            <a href="Javascript:divExpandCollapse('div<%# Eval("POID") %>');">
                                <img id="imgdiv<%#Eval("POID") %>" width="9px" border="0" src="../../Menu/images/plus.gif" />
                            </a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="P.O. No." ItemStyle-HorizontalAlign="Left" DataField="PoVoucherNo"
                        NullDisplayText="-" />
                    <asp:BoundField HeaderText="Vendor Name" ItemStyle-HorizontalAlign="Left" DataField="Lname" />
                    <asp:BoundField HeaderText="Delivery Date" DataField="DeliveryDate" ItemStyle-HorizontalAlign="Left" />
                    <asp:BoundField HeaderText="Priority" DataField="Priority" ItemStyle-HorizontalAlign="Left" />
                    <asp:BoundField HeaderText="Quantity" DataField="Quantity" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField HeaderText="Total Amount" DataField="GrandTotal" ItemStyle-HorizontalAlign="Right" />
                    <asp:TemplateField HeaderText="Status" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Label ID="lblStatusOfPO" runat="server"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Details" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtnview" runat="server"><a href="#" onclick="window.open('InventoryPrint/Default.aspx?Poid=<%#DataBinder.Eval(Container.DataItem,"POID")%>','','width=800,height=600,toolbar=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes')">View</a></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkEdit" CommandArgument='<%#Eval("POID") %>' CommandName="editpo"
                                runat="server" Font-Underline="false"><img src="../../Menu/images/Edit_user.png" alt="Edit"/></asp:LinkButton>
                            <asp:Image ID="imgLock" runat="server" ImageUrl="../../Images/lock.png" Height="16px"
                                Width="16px" AlternateText="Approved" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <tr>
                                <td colspan="100%">
                                    <div id="div<%# Eval("POID") %>" style="display: none; position: relative; left: 15px;
                                        overflow: auto">
                                        <asp:GridView ID="gvPORemarksChild" runat="server" CssClass="gridview" AutoGenerateColumns="false"
                                            Width="96%">
                                            <Columns>
                                                <asp:TemplateField HeaderText="S.No">
                                                    <ItemTemplate>
                                                        <%# Container.DataItemIndex+1 %>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:BoundField DataField="POSTAGE" HeaderText="By Whom" />
                                                <asp:BoundField DataField="REMARKS" HeaderText="Remarks" NullDisplayText="--" />
                                                <asp:BoundField DataField="REVISIONORDER" HeaderText="Revision Order" NullDisplayText="--" />
                                                <asp:BoundField DataField="CDATE" HeaderText="Date" ItemStyle-HorizontalAlign="Right" />
                                                <%--<asp:BoundField DataField="CTIME" HeaderText="Time" ItemStyle-HorizontalAlign="Right" />--%>
                                            </Columns>
                                        </asp:GridView>
                                    </div>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            </div>
            <div class="tab-content" id="ViewtabOther" runat="server">
                <asp:GridView ID="grdInternational" Width="99%" runat="server" AutoGenerateColumns="false"
                CssClass="gridview" AllowPaging="false" DataKeyNames="POID" AlternatingRowStyle-CssClass="gridview_alternate"
                PagerStyle-CssClass="pgr"
                RowStyle-CssClass="gridviewitem" FooterStyle-CssClass="gridviewitem" OnRowCommand="grdInternational_RowCommand"
                OnRowDataBound="grdInternational_RowDataBound" OnRowCreated="grdInternational_RowCreated"
                PageSize="500">
                <Columns>
                    <asp:TemplateField HeaderText="S.No." ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <%# Container.DataItemIndex+1 %>
                            <a href="Javascript:divExpandCollapse('div<%# Eval("POID") %>');">
                                <img id="imgdiv<%#Eval("POID") %>" width="9px" border="0" src="../../Menu/images/plus.gif" />
                            </a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="P.O. No." ItemStyle-HorizontalAlign="Left" DataField="PoVoucherNo" NullDisplayText="-" />
                    <asp:BoundField HeaderText="Vendor Name" ItemStyle-HorizontalAlign="Left" DataField="Lname" />
                    <asp:BoundField HeaderText="Delivery Date" DataField="DeliveryDate" ItemStyle-HorizontalAlign="Left" />
                    <asp:BoundField HeaderText="Priority" DataField="Priority" ItemStyle-HorizontalAlign="Left" />
                    <asp:BoundField HeaderText="Quantity" DataField="Quantity" ItemStyle-HorizontalAlign="Right" />
                    <asp:BoundField HeaderText="Total Amount" DataField="GrandTotal" ItemStyle-HorizontalAlign="Right" />
                    <asp:TemplateField HeaderText="Status" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:Label ID="lblStatusOfPO" runat="server"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Details" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:LinkButton ID="lbtnview" runat="server"><a href="#" onclick="window.open('InventoryPrint/Default.aspx?Poid=<%#DataBinder.Eval(Container.DataItem,"POID")%>','','width=800,height=600,toolbar=yes,status=yes,menubar=no,scrollbars=yes,resizable=yes')">View</a></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Action" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkEdit" CommandArgument='<%#Eval("POID") %>' CommandName="editpo"
                                runat="server" Font-Underline="false"><img src="../../Menu/images/Edit_user.png" alt="Edit"/></asp:LinkButton>
                            <asp:Image ID="imgLock" runat="server" ImageUrl="../../Images/lock.png" Height="16px"
                                Width="16px" AlternateText="Approved" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <tr>
                                <td colspan="100%">
                                    <div id="div<%# Eval("POID") %>" style="display: none; position: relative; left: 15px;
                                        overflow: auto">
                                        <asp:GridView ID="gvPOIRemarksChild" runat="server" CssClass="gridview" AutoGenerateColumns="false"
                                            Width="96%">
                                            <Columns>
                                                <asp:TemplateField HeaderText="S.No">
                                                    <ItemTemplate>
                                                        <%# Container.DataItemIndex+1 %>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:BoundField DataField="POSTAGE" HeaderText="By Whom" />
                                                <asp:BoundField DataField="REMARKS" HeaderText="Remarks" NullDisplayText="--" />
                                                <asp:BoundField DataField="REVISIONORDER" HeaderText="Revision Order" NullDisplayText="--" />
                                                <asp:BoundField DataField="CDATE" HeaderText="Date" ItemStyle-HorizontalAlign="Right" />
                                                <%--<asp:BoundField DataField="CTIME" HeaderText="Time" ItemStyle-HorizontalAlign="Right" />--%>
                                            </Columns>
                                        </asp:GridView>
                                    </div>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
            </div>
        </center>
    </div>
    <script type="text/javascript" language="javascript">
        function hidecontrol() {
            var count = document.getElementById("ddlcurrency").value;
            if (count > 1) {
                document.getElementById("manditory").style.display = "block";
                return true;
            }
            else if (count <= 1) {
                document.getElementById("manditory").style.display = "none";
                return true;
            }
        }

        function calcQty() {
            var Count = document.getElementById("hidControl").value;
            var total_qty = 0;
            for (var i = 1; i <= Count; i++) {
                var qty = 0;
                if (document.getElementById("txtQty" + i).value != '') {
                    qty = parseFloat(document.getElementById("txtQty" + i).value);
                    document.getElementById("txtQty" + i).value = qty;
                }
                total_qty += qty;
            }
            document.getElementById("txtTotalItem").value = total_qty.toFixed(2);
        }
        function calcRateExcl() {
            var Count = document.getElementById("hidControl").value;
            for (var i = 1; i <= Count; i++) {
                var qty = 0;
                if (document.getElementById("txtRateExcTax" + i).value != '') {
                    qty = parseFloat(document.getElementById("txtRateExcTax" + i).value);
                    document.getElementById("txtRateExcTax" + i).value = qty.toFixed(5);
                }
            }
        }
        function calcAmt() {
            var count = document.getElementById("hidControl").value;
            var Amountpayble = 0;
            var taxableamount = 0;
            var posttaxtotal = 0;
            for (var i = 1; i <= count; i++) {
                if (document.getElementById("txtQty" + i).value != '') {
                    if (document.getElementById("txtRateExcTax" + i).value != '') {
                        Amountpayble = parseFloat(document.getElementById("txtQty" + i).value) * parseFloat(document.getElementById("txtRateExcTax" + i).value);
                        document.getElementById("txtAmountPayable" + i).value = Amountpayble.toFixed(5);
                        taxableamount += parseFloat(document.getElementById("txtAmountPayable" + i).value);
                    }
                    else {
                        document.getElementById("txtAmountPayable" + i).value = '0.00';
                    }
                }
                else {
                    //document.getElementById("txtAmountPayable" + i).value = '0.00';
                }
            }
            document.getElementById("txtTaxableAmt").value = taxableamount.toFixed(5);
            document.getElementById("txtPostTaxTotal").value = taxableamount.toFixed(5);
            document.getElementById("txtGrandTotal").value = parseFloat(parseFloat(taxableamount) + parseFloat(document.getElementById("txtRoundoff").value)).toFixed(5);
        }
        function calcAmt1() {
            var Count = document.getElementById("hidControl").value;
            var taxable_amt = 0;
            var VATCST_amt = 0;
            var pretax_amt = 0;
            for (var i = 1; i <= Count; i++) {
                var qty = 0;
                var amt = 0;
                var total_amt = 0;

                if (document.getElementById("txtQty" + i).value != '') {
                    var tax = document.getElementById("hidTaxRate" + i).value;
                    qty = parseFloat(document.getElementById("txtQty" + i).value);
                    if (document.getElementById("txtRateExcTax" + i).value != '') {
                        amt = parseFloat(document.getElementById("txtRateExcTax" + i).value);
                        document.getElementById("txtRateExcTax" + i).value = amt.toFixed(2);

                        if (tax == '' || tax == '0') {
                            total_amt = qty * amt;
                            document.getElementById("txtRateIncTax" + i).value = amt.toFixed(2);
                            taxable_amt += total_amt;
                        }
                        else {
                            var val = (parseFloat(tax) * parseFloat(amt)) / 100;
                            var rateIncl_amt = parseFloat(amt) + parseFloat(val);
                            document.getElementById("txtRateIncTax" + i).value = rateIncl_amt.toFixed(2);
                            total_amt = qty * rateIncl_amt;
                            taxable_amt += qty * amt;
                            VATCST_amt += (qty * amt * tax) / 100;
                        }
                        pretax_amt += amt;
                    }
                    else {
                        document.getElementById("txtRateIncTax" + i).value = '';
                    }
                    document.getElementById("txtAmountPayable" + i).value = total_amt.toFixed(2);
                }
            }
            document.getElementById("txtTaxableAmt").value = taxable_amt.toFixed(2);
            //document.getElementById("txtPreTotalTax").value = pretax_amt.toFixed(2);
            document.getElementById("txtVat").value = VATCST_amt.toFixed(2);
            var posttax_amt = taxable_amt + VATCST_amt;
            document.getElementById("txtPostTaxTotal").value = posttax_amt.toFixed(2);
            document.getElementById("txtGrandTotal").value = posttax_amt.toFixed(2);
        }
        function CreditDays() {
            if (document.getElementById("txtCreditDay").value != '') {
                var days = document.getElementById("txtCreditDay").value;
                if (parseFloat(days) > 365) {
                    alert('Maximum Credit Days is 365 days');
                    document.getElementById("txtCreditDay").value = '365';
                }
                document.getElementById("radioCash").checked = false;
                document.getElementById("radioCredit").checked = true;
            }
            else {
                document.getElementById("radioCash").checked = true;
                document.getElementById("radioCredit").checked = false;
            }
        }
        function RoundOff() {
            var posttax = document.getElementById("txtPostTaxTotal").value;
            if (document.getElementById("txtRoundoff").value != '') {
                var roundoff = document.getElementById("txtRoundoff").value;
                var GrandTotal = parseFloat(posttax) + parseFloat(roundoff);
                document.getElementById("txtGrandTotal").value = GrandTotal.toFixed(5);
            }
            else {
                document.getElementById("txtRoundoff").value = '0.00'
                document.getElementById("txtGrandTotal").value = parseFloat(posttax).toFixed(5);
            }
        }
        function ValidateItems() {
            //For Check the Mode of Dispatch
            var ModeDispatch = document.getElementById("RblModeDispatch").getElementsByTagName("input");
            var ModeDispatchValue = '';
            for (var j = 0; j < ModeDispatch.length; j++) {
                //alert(ModeDispatch[j].checked);
                if (ModeDispatch[j].checked) {
                    ModeDispatchValue = ModeDispatch[j].value;
                }
            }
            //For Check the Acceptance Criteria
            var AcceptanceCriteria = document.getElementById("RblAcceptanceCriteria").getElementsByTagName("input");
            var AcceptanceCriteriaValue = '';
            for (var j = 0; j < AcceptanceCriteria.length; j++) {
                if (AcceptanceCriteria[j].checked) {
                    AcceptanceCriteriaValue = AcceptanceCriteria[j].value;
                }
            }
            //For Check the Validity of PO
            var ValidityOFPO = document.getElementById("RblvalidityofPO").getElementsByTagName("input");
            var ValidityOFPOValue = '';
            for (var j = 0; j < ValidityOFPO.length; j++) {
                if (ValidityOFPO[j].checked) {
                    ValidityOFPOValue = ValidityOFPO[j].value;
                }
            }
            //For Check the Insurance
            var Insurance = document.getElementById("RblInsurance").getElementsByTagName("input");
            var InsuranceValue = '';
            for (var j = 0; j < Insurance.length; j++) {
                if (Insurance[j].checked) {
                    InsuranceValue = Insurance[j].value;
                }
            }
            //For Freight
            var Freights = document.getElementById("RBLFreight").getElementsByTagName("input");
            var FreightValue = '';
            for (var j = 0; j < Freights.length; j++) {
                if (Freights[j].checked) {
                    FreightValue = Freights[j].value;
                }
            }
            //For Check the Warranty
            var Warranty = document.getElementById("RblWarranty").getElementsByTagName("input");
            var WarrantyValue = '';
            for (var j = 0; j < Warranty.length; j++) {
                if (Warranty[j].checked) {
                    WarrantyValue = Warranty[j].value;
                }
            }

            if (document.getElementById("ddlFormat").selectedIndex == 0) {
                alert('Please Select Bill Format ');
                document.getElementById("ddlFormat").focus();
                return false;
            }
            else if (document.getElementById("ddlSupplier").selectedIndex == 0) {
                alert('Please Select Supplier.');
                document.getElementById("ddlSupplier").focus();
                return false;
            } else if (document.getElementById("DdlLocation").selectedIndex == 0) {
                alert('Please Select Delivery Location.');
                document.getElementById("DdlLocation").focus();
                return false;
            } else if (document.getElementById("ddlleased").selectedIndex == 0) {
                alert('Please Select Leased Type.');
                document.getElementById("ddlleased").focus();
                return false;
            }
            else if (document.getElementById("ddlcurrency").selectedIndex == 0) {
                alert('Please Select Currency.');
                document.getElementById("ddlcurrency").focus();
                return false;
            }
            else if (document.getElementById("txtBillAddress").value == '') {
                alert('Please Enter Billing Address From Other Tab.');
                document.getElementById("txtBillAddress").focus();
                return false;
            }
            else if (document.getElementById("txtDeliveryAdd").value == '') {
                alert('Please Enter Delivery Address From Other Tab.');
                document.getElementById("txtDeliveryAdd").focus();
                return false;
            }
            //For domestic
            else if (document.getElementById("txtDeliveryTerms").value == '' && document.getElementById("ddlFormat").selectedIndex == 2) {
                alert('Please Enter Delivery Terms From Other Tab.');
                document.getElementById("txtDeliveryTerms").focus();
                return false;
            }
            //For International
            else if (document.getElementById("ddlDeliveryTerms").selectedIndex == 0 && document.getElementById("ddlFormat").selectedIndex == 1) {
                alert('Please Select Delivery Terms From Other Tab.');
                document.getElementById("ddlDeliveryTerms").focus();
                return false;
            }
            else if (document.getElementById("txttaxDuties").value == '') {
                alert('Please Enter Tax Duties From Other Tab.');
                document.getElementById("txttaxDuties").focus();
                return false;
            }
            else if (ModeDispatchValue == '') {
                alert("Please Select the Mode of Dispatch From Other Tab.");
                return false;
            }
            else if (ModeDispatchValue == 0 && document.getElementById("txtModeDispatch").value == '') {
                alert('Please Enter Mode Of Dispatch From Other Tab.');
                //document.getElementById("txtModeDispatch").focus();
                return false;
            }
            else if (document.getElementById("txtDeliveryDate").value == '') {
                alert('Please Enter Delivery Date From Other Tab.');
                document.getElementById("txtDeliveryDate").focus();
                return false;
            }
            else if (AcceptanceCriteriaValue == '') {
                alert("Please Select the Acceptance Criteria From Other Tab.");
                return false;
            }
            else if (AcceptanceCriteriaValue == '0' && document.getElementById("txtAcceptanceCriteria").value == '') {
                alert('Please Enter Acceptance Criteria From Other Tab.');
                document.getElementById("txtAcceptanceCriteria").focus();
                return false;
            }
            else if (ValidityOFPOValue == '') {
                alert("Please Select the Validity Of PO From Other Tab.");
                return false;
            }
            else if (ValidityOFPOValue == 0 && document.getElementById("txtvalidityofPO").value == '') {
                alert('Please Enter Validity Of PO From Other Tab.');
                document.getElementById("txtvalidityofPO").focus();
                return false;
            }
            else if (InsuranceValue == '') {
                alert("Please Select the Insurance From Other Tab.");
                return false;
            }
            else if (InsuranceValue == 0 && document.getElementById("txtInsurance").value == '') {
                alert('Please Enter Insurance From Other Tab.');
                document.getElementById("txtInsurance").focus();
                return false;
            }
            else if (WarrantyValue == '') {
                alert("Please Select the Warranty From Other Tab.");
                return false;
            }
            else if (WarrantyValue == 0 && document.getElementById("txtWarranty").value == '') {
                alert('Please Enter Warranty From Other Tab.');
                document.getElementById("txtWarranty").focus();
                return false;
            }
            else if (document.getElementById("txtanyspecialcondition").value == '') {
                alert('Please Enter Any Special Condition From Other Tab.');
                document.getElementById("txtanyspecialcondition").focus();
                return false;
            }
            else if (document.getElementById("txtfreightfwd").value == '') {
                alert('Please Enter Freight Forwader From Other Tab.');
                document.getElementById("txtfreightfwd").focus();
                return false;
            }
            else if (document.getElementById("txtimpacno").value == '') {
                alert('Please Enter Import Account Number From Other Tab.');
                document.getElementById("txtimpacno").focus();
                return false;
            }
            else if (FreightValue == '') {
                alert("Please Select the Freights From Other Tab.");
                return false;
            }
            else if (FreightValue == 0 && document.getElementById("txtfreight").value == '') {
                alert('Please Enter Freight From Other Tab.');
                document.getElementById("txtfreight").focus();
                return false;
            }
            else {
                return true;
            }
            //return flag;
        }
        function ValidateItems1() {
            //var flag=new Boolean(true);
            var Count = document.getElementById("hidControl").value;
            var set = 0;
            for (var i = 1; i <= Count; i++) {
                if (document.getElementById("txtItem" + i).value == '' && document.getElementById("txtQty" + i).value == '' && document.getElementById("txtRateExcTax" + i).value == '') {
                    set = set + 1;
                }
                if (set == Count) {
                    alert('Please Create At least one Item');
                    document.getElementById("txtItem1").focus();
                    return false;
                }
            }
            if (Count != set) {
                for (var i = 1; i <= Count; i++) {
                    if (document.getElementById("txtItem" + i).value != '') {
                        if (document.getElementById("txtQty" + i).value == '' || document.getElementById("txtQty" + i).value == 0) {
                            alert('Please Specify Quantity at Row No ' + ' ' + i);
                            document.getElementById("txtQty" + i).focus();
                            return false;
                        }
                        if (document.getElementById("ddlleased").selectedIndex == 1)//Owned
                        {
                            if (document.getElementById("txtRateExcTax" + i).value == '' || document.getElementById("txtRateExcTax" + i).value == 0) {
                                alert('Please Specify Rate Exclusive Tax at Row No ' + ' ' + i);
                                document.getElementById("txtRateExcTax" + i).focus();
                                return false;
                            }
                        }
                        if (document.getElementById("ddlleased").selectedIndex == 2) //Consigned
                        {
                            if (document.getElementById("txtRateExcTax" + i).value == '') {
                                alert('Please Specify Rate Exclusive Tax at Row No ' + ' ' + i);
                                document.getElementById("txtRateExcTax" + i).focus();
                                return false;
                            }
                        }
                        if (document.getElementById("ddlFormat").selectedIndex == 1)//for Domestic
                        {
                            if (document.getElementById("ddlTaxType" + i).selectedIndex == 0) {
                                alert('Please Specify VAT/CST at Row no ' + '' + i);
                                document.getElementById("ddlTaxType" + i).focus();
                                return false;
                            }
                        }
                    }
                    else if (document.getElementById("txtQty" + i).value != '') {
                        if (document.getElementById("txtItem" + i).value == '') {
                            alert('Please Specify Item in Row No ' + ' ' + i);
                            document.getElementById("txtItem" + i).focus();
                            return false;
                        }
                        if (document.getElementById("ddlleased").selectedIndex == 1) //Owned
                        {
                            if (document.getElementById("txtRateExcTax" + i).value == '' || document.getElementById("txtRateExcTax" + i).value == 0) {
                                alert('Please Specify Rate Exclusive Tax at Row No ' + ' ' + i);
                                document.getElementById("txtRateExcTax" + i).focus();
                                return false;
                            }
                        }
                        if (document.getElementById("ddlleased").selectedIndex == 2) //Consigned
                        {
                            if (document.getElementById("txtRateExcTax" + i).value != '') {
                                alert('Please Specify Rate Exclusive Tax at Row No ' + ' ' + i);
                                document.getElementById("txtRateExcTax" + i).focus();
                                return false;
                            }
                        }
                        if (document.getElementById("ddlFormat").selectedIndex == 1)//for Domestic
                        {
                            if (document.getElementById("ddlTaxType" + i).selectedIndex == 0) {
                                alert('Please Specify VAT/CST at Row no ' + '' + i);
                                document.getElementById("ddlTaxType" + i).focus();
                                return false;
                            }
                        }
                    }
                    else if (document.getElementById("txtRateExcTax" + i).value != '') {
                        if (document.getElementById("txtQty" + i).value == '' || document.getElementById("txtQty" + i).value == 0) {
                            alert('Please Specify Quantity in Row No ' + ' ' + i);
                            document.getElementById("txtQty" + i).focus();
                            return false;
                        }
                        if (document.getElementById("txtItem" + i).value == '') {
                            alert('Please Specify Item in Row No ' + ' ' + i);
                            document.getElementById("txtItem" + i).focus();
                            return false;
                        }
                        if (document.getElementById("ddlFormat").selectedIndex == 1)//for Domestic
                        {
                            if (document.getElementById("ddlTaxType" + i).selectedIndex == 0) {
                                alert('Please Specify VAT/CST at Row no ' + '' + i);
                                document.getElementById("ddlTaxType" + i).focus();
                                return false;
                            }
                        }
                    }
                }
            }
            return true;
        }
        function ValidationInput() {
            if (ValidateItems() == true && ValidateItems1() == true)// && CheckDuplicateRow()==true) 
            {
                //alert("hello");
                return true;

            }
            else {
                return false;
            }
        }
        function checkItemRepetion(id) {
            var ddl = document.getElementById(id);
            var currentValue = ddl.options[ddl.selectedIndex].value;
            var Count = document.getElementById("hidControl").value;
            for (var i = 1; i <= Count; i++) {
                var previous = document.getElementById("ddlItem" + i);
                var previousValue = previous.options[previous.selectedIndex].value
                if (ddl != previous) {
                    if (currentValue == previousValue) {
                        alert('Please Select Unique Item');
                        ddl.selectedIndex = 0;
                        break;
                    }
                }
            }
            return true;
        }
        function disableCredit() {
        }
    </script>
    <%--    <script src="../../Menu/js/jquery.min.js" type="text/javascript"></script>--%>
    <script src="../../JavaScript/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="../../JavaScript/HorizontalTab.js" type="text/javascript"></script>
    <script src="../../JavaScript/Commons.js" type="text/javascript"></script>
    </form>
</body>
</html>
